package com.astar.mapper;

import com.astar.entity.CustomQuestion;
import com.astar.entity.PraCouChapQuestion;
import com.astar.entity.PractiseCourseChapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 分类练习-科目-章节-题目  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2020-01-31
 */
@Repository
public interface PraCouChapQuestionMapper extends BaseMapper<PraCouChapQuestion> {

    List<CustomQuestion> selectAll(CustomQuestion customQuestion);

    CustomQuestion selectOnes(Integer id);

    @Select("select  distinct  QUESTION_TYPE from pra_cou_chap_question")
    List<CustomQuestion> selectQuestionType();

    @Select("select  distinct  chapter_name,id from practise_course_chapter")
    List<PractiseCourseChapter> selectChapter();

    @Select("select chapter_name,pcc.id,pct.COURSE_NAME from practise_course_chapter pcc INNER JOIN practise_course_type pct on pcc.COURSE_ID = pct.ID where pct.ID =#{id}")
    List<CustomQuestion> changeChapter(Integer id);

}
